package com.ptswitch.material.model.common;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.Size;

import org.hibernate.annotations.ColumnDefault;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import org.hxzon.project.BaseEntity;

@Entity
public class EMailAddress extends BaseEntity {
    private static final long serialVersionUID = 7570429986649512051L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_seq_gen_emailaddr")
    @javax.persistence.SequenceGenerator(name = "id_seq_gen_emailaddr", sequenceName = "seq_id_emailaddr", allocationSize = 20)
    private long id;

    @ColumnDefault(StringDefaultValue)
    @Size(max = DefineSize32)
    @NotEmpty
    private String realname = "xxx";

    @ColumnDefault(StringDefaultValue)
    @Size(max = DefineSize2048)
    @NotEmpty
    @Email
    private String email;

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return this.realname + "(" + this.email + ")";
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }
}
